package com.neuedu.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.neuedu.entity.Customer;
import com.neuedu.entity.Room;
import com.neuedu.service.CustomerService;
import com.neuedu.service.RoomService;
import com.neuedu.vo.ResultJson;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;

/**
 * <p>
 * 客户表 前端控制器
 * </p>
 *
 * @author wangyu
 * @since 2025-10-15
 */
@RestController
@RequestMapping("/customer")
public class CustomerController {
    @Resource
    RoomService roomService;
    @Resource
    CustomerService customerService;

    @GetMapping("/list")
    ResultJson<IPage<Customer>> list(Integer pageNo, Integer pageSize) {
        return ResultJson.success(customerService.list(pageNo, pageSize));
    }
    @PostMapping("/add")
    ResultJson<Boolean> add(Customer customer) {
        return ResultJson.success(customerService.add(customer), "办理入住成功");
    }
    @GetMapping("/getById")
    ResultJson<Customer> getById(Integer id) {
        return ResultJson.success(customerService.getById(id));
    }
    @PostMapping("/update")
    ResultJson<Boolean> update(Customer customer) {
        return ResultJson.success(true, "修改成功");
    }
    @PostMapping("/delete")
    ResultJson<Boolean> delete(Integer id) {
        return ResultJson.success(customerService.delete(id), "删除成功");
    }
}
